def decode_string(s):
    def helper(s, index):
        result = ''
        while index < len(s):
            if s[index].isdigit():
                num = 0
                while index < len(s) and s[index].isdigit():
                    num = num * 10 + int(s[index])
                    index += 1
                if s[index] == '[':
                    index += 1
                    nested_string, index = helper(s, index)
                    result += nested_string * num
                else:
                    return result, index
            else:
                if s[index] == ']':
                    index += 1
                    return result, index
                else:
                    result += s[index]
                index += 1
        return result, index

    return helper(s, 0)[0]

if __name__ == "__main__":
    input_str = input("请输入字符串：")
    decoded_str = decode_string(input_str)
    print("字符串结果为：", decoded_str)